using System.Collections.Generic;
using System.Web;

namespace OpenWaves.ImageTransformations.Web
{
    public class CompositeWebImageTransformationModuleImplementation : IWebImageTransformationModuleImplementation
    {
        private readonly IEnumerable<IWebImageTransformationModuleImplementation> implementations;

        public CompositeWebImageTransformationModuleImplementation(params IWebImageTransformationModuleImplementation[] implementations)
        {
            this.implementations = implementations;
        }

        public bool PostAuthorizeRequest(HttpContextBase context)
        {
            foreach (var implementation in this.implementations)
            {
                if (implementation.PostAuthorizeRequest(context))
                    return true;
            }
            return false;
        }
    }
}